# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Sequencer <liujiuyang1994@gmail.com>

pkgname=python-schemdraw
pkgver=0.16
pkgrel=1
pkgdesc="Electrical circuit schematic drawing."
url="https://bitbucket.org/cdelker/schemdraw"
license=('BSD')
arch=('any')
depends=('python')
optdepends=('python-matplotlib: for matplotlib backend'
            'python-ziafont: for svg backend'
            'python-ziamath: for svg backend'
            'python-latex2mathml: for svg backend')
makedepends=('python-build' 'python-installer' 'python-wheel' 'python-setuptools')
checkdepends=('python-pytest-runner' 'python-nbval' 'python-matplotlib' 'python-ziafont'
              'python-ziamath' 'python-latex2mathml')
source=("$pkgname-$pkgver.tar.bz2::https://bitbucket.org/cdelker/schemdraw/get/$pkgver.tar.bz2")
sha512sums=('d8f8f0547cbc2e6f32cac80ae522a91a243a903f7cc0d253e677efdf07e9f38bd0f0ad57483974d9ce362c1190f07f7de142a7522b52219d600eef90056a48ba')

prepare() {
  mv cdelker-schemdraw-* schemdraw-$pkgver
}

build() {
  cd schemdraw-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd schemdraw-$pkgver
  PYTHONPATH="$PWD/build/lib" pytest --nbval-lax
}

package() {
  cd schemdraw-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
}
